<?php
/**
 * Created by PhpStorm.
 * User: lh
 * Date: 2020/1/20
 * Time: 11:55
 */

namespace App\Services\Com;


use App\Models\Common\Config;

class ConfigService
{
    /**
     * 获取配置
     * @param $key
     * @return mixed
     * @throws \Exception
     */
    public static function find($key){
        try {
            $config = Config::where('key', '=', $key)->first();

            if(empty($config)) throw new \Exception('没有该配置');

            return $config->value;
        }catch (\Exception $e){
            throw new \Exception($e->getMessage());
        }
    }
}